// 封装节流函数
export function throttle(fn, interval) {
    let startTime = 0;
    const _throttle = () => {
        const nowTime = new Date().getTime();
        const awaitTime = interval - (nowTime - startTime);
        if (awaitTime <= 0) {
            fn();
            startTime = nowTime;
        }
    }
    return _throttle;   // 返回一个函数
}